package com.gome.spiderkit.webserver;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;

public class WebServer {
    Server server = null;
    WebAppContext context = null;
    
    public WebServer(int port) {
    	server = new Server(9090);
    	context = new WebAppContext();
        context.setDescriptor(System.getProperty("user.dir") + "/src/main/webapp/WEB-INF/web.xml");
        context.setResourceBase("src/main/webapp");  
        context.setDisplayName("SSServer");
        context.setClassLoader(Thread.currentThread().getContextClassLoader());  
        context.setConfigurationDiscovered(true);  
        context.setParentLoaderPriority(true);  
        server.setHandler(context);
    }
    
    public void start() {
        try {
			server.start();
			server.join();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
    
}
